package com.service;

import com.mapper.PostgraduateInfoMapper;
import com.service.impl.PostgraduateInfoServiceImpl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;

/**
 * <p>
 * 考研信息管理 Service 测试类
 * </p>
 * @author 34448
 */
public class PostgraduateInfoServiceTest {

    @Mock
    private PostgraduateInfoMapper postgraduateInfoMapper;

    @InjectMocks
    private PostgraduateInfoServiceImpl postgraduateInfoService;

    @BeforeEach
    public void setUp() {
        MockitoAnnotations.openMocks(this);
    }

    @Test
    public void testCountPostgraduateInfoSharing() {
        List<Map<String, Object>> expected = new ArrayList<>();
        Map<String, Object> map = new HashMap<>();
        map.put("share_status", true);
        map.put("count", 20);
        expected.add(map);

        when(postgraduateInfoMapper.countPostgraduateInfoSharing()).thenReturn(expected);

        List<Map<String, Object>> result = postgraduateInfoService.countPostgraduateInfoSharing();
        assertEquals(expected, result);
    }
}